#include "TemplatexPLSchema.h"

TemplatexPLSchema::TemplatexPLSchema()
{
    this->name = "";
}

TemplatexPLSchema::TemplatexPLSchema(const QString &name)
{
    this->name = name;
}

TemplatexPLSchema::TemplatexPLSchema(const QString &name, const QList<TemplatexPLClass> &list)
{
    this->name = name;
    this->classList = list;
}

TemplatexPLSchema::TemplatexPLSchema(const TemplatexPLSchema &other)
{
    this->name = other.name;
    this->classList = other.classList;
}

TemplatexPLSchema& TemplatexPLSchema::operator =(const TemplatexPLSchema& other)
{
    this->name = other.name;
    this->classList = other.classList;
    return *this;
}

TemplatexPLSchema::~TemplatexPLSchema()
{

}

bool TemplatexPLSchema::equals(const TemplatexPLSchema &other) const
{
    return (this->name == other.name && this->classList == other.classList);
}

QString TemplatexPLSchema::toString() const
{
    return this->toXml();
}

QString TemplatexPLSchema::toXml() const
{
    QString rslt = "<schema name=\"%1\">\n";
    for(int i = 0; i < classes().count(); i++)
        rslt += "\t"+classes().at(i).toXml();
    rslt += "</schema>";
    return rslt.arg(name);
}
